﻿<%@ Page Language="C#" AutoEventWireup="true" Inherits="Matriculas_Pessoa" Codebehind="Pessoa.aspx.cs" %>
<%@ Register assembly="Telerik.Web.UI" namespace="Telerik.Web.UI" tagprefix="telerik" %>

<%@ Register src="../Usercontrol/wuscSeguranca.ascx" tagname="wuscSeguranca" tagprefix="uc1" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <title>Qvaliz.CTM.Inspeções</title>
    
    <script type="text/javascript">

        //      função para inserir alunos
        function OpenWnd() {
            $find("pessoa_id").set_value("");
            $find("pes_cpf").set_value("");
            $find("pes_nome").set_value("");
            $find("pes_dtnascimento").set_value("");
            

            window.radopen("Pessoa_cadastro.aspx?operacao=insert", "wndInsert");
            return false;
        }

        //      função para editar alunos
        function ShowEditForm(id, rowIndex) {

            window.radopen("Pessoa_cadastro.aspx?operacao=edit&PESSOA_ID=" + id, "wndEdit");
            return false;
        }

        //      função exibir Auditoria
        function ShowAuditoria(id, rowIndex) {

            window.radopen("Auditoria.aspx?operacao=select&interface=PESSOA&interface_id=" + id, "wndAuditoria");
            return false;
        }

        //      função exibir Alunos Associados 
        function ShowAlunosAssociados(id, rowIndex) {

            window.radopen("../Matriculas/Aluno_pessoa.aspx?operacao=select&PESSOA_ID=" + id, "wndAlunosPes");
            return false;
        }

        //      função para tratar duplo click no grid
        function RowDblClick(sender, eventArgs) {
            window.radopen("Pessoa_cadastro.aspx?operacao=edit&PESSOA_ID=" + eventArgs.getDataKeyValue("PESSOA_ID"), "wndEdit");
        }

        //      função para carregar o grid via panel ajax
        function LoadGrid() {
            $find("rapGrid").ajaxRequest("load");
        }

        //      função para tratar o evento CLOSE de RadWindow via Clientside EDIT
        function OnClientClose() {
            $find("rapGrid").ajaxRequest("load");
        }

        //      função para tratar o evento CLOSE de RadWindow via Clientside INSERT
        function OnClientCloseInsert(oWnd, args) {
            //  obter os parametros transferidos pelo Pop-up
            var arg = args.get_argument();
            if (arg) {
                $find("pessoa_id").set_value(arg.diretivaID);
                $find("rapGrid").ajaxRequest("load");
            }
        }

        //      função para EXCLUIR o Material
        function WndDelete(id, rowIndex) {

            window.radopen("../Administracao/Excluir_registro.aspx?operacao=delete&interface=PESSOA&interface_id_value=" + id, "wndRemover");
            return false;
        }
    </script>

</head>
<body>
    <form id="form2" runat="server">
     <asp:ObjectDataSource ID="ods_Pessoa" runat="server"  
        SelectMethod="_obter_Pessoa" TypeName="Banco.BD_Pessoa" 
         onselecting="ods_Pessoa_Selecting"> 
        <SelectParameters> 
            <asp:Parameter Name="PESSOA_ID" Type="String" /> 
            <asp:Parameter Name="PES_NOME" Type="String" /> 
            <asp:Parameter Name="PES_DTNASCIMENTO" Type="String" /> 
            <asp:Parameter Name="PES_RG" Type="String" /> 
            <asp:Parameter Name="PES_CPF" Type="String" /> 
            <asp:Parameter Name="PROFISSAO_ID" Type="String" /> 
            <asp:Parameter Name="SOLICITANTE_ID" Type="String" />
            <asp:Parameter Name="PES_FALECIDO" Type="String" />
            <asp:Parameter Name="ORDER_BY_CLAUSE" Type="String" />
        </SelectParameters> 
    </asp:ObjectDataSource> 
    
      

     <uc1:wuscSeguranca ID="wuscSeguranca1" runat="server" />
    
      

    <telerik:RadWindowManager ID="RadWindowManager1" runat="server" AutoSize="false"
         ShowContentDuringLoad="False" Skin="Sunset" 
        EnableShadow="true" ReloadOnShow="True" Animation="Resize" 
        AnimationDuration="200" Modal="True">
            <Windows>
                <telerik:RadWindow ID="wndEdit" runat="server" Title="Editar Material" Height="370px"
                    Width="850px" Left="500px" ReloadOnShow="true" ShowContentDuringLoad="false"
                    Modal="true" Behavior="Close, Pin, Move, Reload"
                    OnClientClose="OnClientClose" VisibleStatusbar="False"/>
                 <telerik:RadWindow ID="wndInsert" runat="server" Title="Inserir novo Material" Height="370px"
                    Width="850px" Left="500px" ReloadOnShow="true" ShowContentDuringLoad="false"
                    Modal="true" Behavior="Close, Pin, Move, Reload"
                    OnClientClose="OnClientClose" VisibleStatusbar="False"/>
                <telerik:RadWindow ID="wndAlunosPes" runat="server" Title="Alunos Associados" Height="370px"
                    Width="850px" Left="500px" ReloadOnShow="true" ShowContentDuringLoad="false"
                    Modal="true" Behavior="Close, Pin, Move, Reload"
                    VisibleStatusbar="False"/>
                <telerik:RadWindow ID="wndAuditoria" runat="server" Title="Auditoria" Height="370px"
                    Width="850px" Left="500px" ReloadOnShow="true" ShowContentDuringLoad="false"
                    Modal="true" Behavior="Close, Pin, Move, Reload"
                    VisibleStatusbar="False"/>
                <telerik:RadWindow ID="wndRemover" runat="server" Title="Excluir Registro" Height="320px"
                    Width="495px" Left="500px" ReloadOnShow="true" ShowContentDuringLoad="false"
                    Modal="true" Behavior="Close, Pin, Move, Reload"
                    OnClientClose="OnClientClose" VisibleStatusbar="False"/>
            </Windows>
    </telerik:RadWindowManager>

    <table width="100%">
        <tr>
            <td>
                <%--<div style="float:left; margin-left:0px; width:10%">
                    <asp:Label ID="lbl_ctm_cad_inspecao_id" runat="server" Text="Código" 
                        Font-Bold="True" Font-Size="X-Small"></asp:Label>
                    <telerik:RadNumericTextBox ID="ctm_cad_inspecao_id" runat="server" Font-Size="X-Small"
                                Width="100%" DataType="System.Int32" ReadOnly="false">
                                <NumberFormat DecimalDigits="0" />
                                <ReadOnlyStyle BackColor="#CCCCCC" />
                    </telerik:RadNumericTextBox>                    
                </div>--%>
                <div style="float:left; margin-left:0px; width:10%">
                    <asp:Label ID="lbl_pessoa_id" runat="server" Text="Código Interno" Font-Bold="True" 
                        Font-Size="X-Small"></asp:Label>
                    <telerik:RadNumericTextBox ID="pessoa_id" runat="server" Font-Size="X-Small"
                                Width="97%" DataType="System.Int32" ReadOnly="false">
                                <NumberFormat DecimalDigits="0" />
                                <ReadOnlyStyle BackColor="#CCCCCC" />
                    </telerik:RadNumericTextBox>                
                </div>
                <div style="float:left; margin-left:14px; width:10%">
                    <asp:Label ID="lbl_pes_cpf" runat="server" Text="CPF" Font-Bold="True" 
                        Font-Size="X-Small"></asp:Label>
                    <telerik:RadNumericTextBox ID="pes_cpf" runat="server" Font-Size="X-Small"
                                Width="97%" DataType="System.Int32" ReadOnly="false">
                                <NumberFormat DecimalDigits="0" />
                                <ReadOnlyStyle BackColor="#CCCCCC" />
                    </telerik:RadNumericTextBox>       
                </div>
                <div style="float:left; margin-left:14px; width:35%">
                    <asp:Label ID="lbl_pes_nome" runat="server" Text="Nome" Font-Bold="True" 
                        Font-Size="X-Small"></asp:Label>
                    <telerik:RadTextBox ID="pes_nome" Runat="server" Font-Size="X-Small" 
                        MaxLength="200"
                        Width="97%">
                    </telerik:RadTextBox>                
                </div>
                <div style="float:left; margin-left:10px; width:10%;">
                    <asp:Label ID="lbl_pes_dtnascimento" runat="server" Text="Data nasc." 
                        Font-Bold="True" Font-Size="X-Small"></asp:Label>        
                    <telerik:RadDateInput ID="pes_dtnascimento" runat="server" Font-Size="X-Small" 
                        Width="97%" AutoPostBack="True">
                        <ReadOnlyStyle BackColor="#D6DCDB" />
                    </telerik:RadDateInput>
                </div>  
                <div style="float:left; margin-left:14px; width:7%">
                    <asp:Label ID="lbl_pes_falecido" runat="server" Text="Falecidos" Font-Bold="true" 
                        Font-Size="X-Small"></asp:Label> <br />
                    <asp:CheckBox ID="pes_falecido" runat="server" />
                </div>
                <div style="float:left; margin-left:14px; width:10%">
                    <asp:Label ID="lbl_orderBy" runat="server" Text="Ordernar por" Font-Bold="True" 
                        Font-Size="X-Small"></asp:Label>
                    <telerik:RadComboBox ID="rcb_orderBy" runat="server" 
                                    Font-Size="X-Small" Width="100%" Filter="Contains" 
                                    EmptyMessage="Selecione" MarkFirstMatch="True" 
                                    EnableLoadOnDemand="True" 
                                    style="margin-bottom: 0px">
                        <Items>
                            <telerik:RadComboBoxItem runat="server" />
                            <telerik:RadComboBoxItem runat="server" Text="CÓDIGO" 
                                Value="PESSOA.PESSOA_ID" Font-Size="X-Small" />
                            <telerik:RadComboBoxItem runat="server" Text="CPF" 
                                Value="PESSOA.PES_CPF" Font-Size="X-Small" />
                            <telerik:RadComboBoxItem runat="server" Text="NOME" 
                                Value="PESSOA.PES_NOME" Font-Size="X-Small" />                            
                            <telerik:RadComboBoxItem runat="server" Text="NASCIMENTO" 
                                Value="PESSOA.PES_DTNASCIMENTO" Font-Size="X-Small" />                            
                        </Items>
                    </telerik:RadComboBox>                    
                </div>
                <div style="float:left; margin-left:14px; width:20px">
                    <asp:Label ID="lblsaltoPagina" runat="server" Text="." Font-Bold="True" 
                        Font-Size="X-Small" ForeColor="White"></asp:Label>             
                    <asp:ImageButton ID="imgbConsultar" runat="server" 
                        ImageUrl="~/Imagens/pagina_lupa_cinza.png" 
                        ToolTip="Localizar" onclientclick="LoadGrid(); return false;" />
                               
                </div>

                <div style="float:right; margin-right:0px; width:20px">
                    <asp:Label ID="lblsaltoPagina2" runat="server" Text="." Font-Bold="True" 
                        Font-Size="X-Small" ForeColor="White"></asp:Label>             
                    <asp:ImageButton ID="imgbIncluir" runat="server" 
                        ImageUrl="~/Imagens/pagina_insert_cinza.png" 
                        onclientclick="OpenWnd();return false;" ToolTip="Inserir novo registro" />
                               
                </div>
            </td>
        </tr>
        <tr>
            <td>
                <telerik:RadScriptManager ID="RadScriptManager1" Runat="server">
                 </telerik:RadScriptManager>                                  

                  <telerik:RadAjaxLoadingPanel ID="ralpGrid" runat="server" Skin="Default">
                </telerik:RadAjaxLoadingPanel>

                <telerik:RadAjaxPanel ID="rapGrid" runat="server" Height="350px" 
                    Width="100%" HorizontalAlign="NotSet" LoadingPanelID="ralpGrid" 
                    onajaxrequest="rapGrid_AjaxRequest">
                 <telerik:RadGrid ID="rdg_Pessoa" runat="server" AutoGenerateColumns="False" 
                    GridLines="None" Skin="Sunset" Width="100%" AllowPaging="True" Font-Size="X-Small" 
                    onselectedindexchanged="rdg_Pessoa_SelectedIndexChanged" 
                    onitemcreated="rdg_Pessoa_ItemCreated">
                    <ClientSettings>
                        <Selecting AllowRowSelect="True" />
                        <ClientEvents OnRowDblClick="RowDblClick" />
                        <Scrolling AllowScroll="True" UseStaticHeaders="True" />
                    </ClientSettings>
                    <MasterTableView CommandItemDisplay="Top" 
                         ClientDataKeyNames="PESSOA_ID" DataKeyNames="PESSOA_ID">
                        <CommandItemSettings ExportToExcelText="Exportar para Excel" 
                            ExportToPdfText="Exportar para PDF" ShowAddNewRecordButton="False" 
                            ShowExportToExcelButton="True" ShowExportToPdfButton="True" />
                            <%--<RowIndicatorColumn FilterControlAltText="Filter RowIndicator column"></RowIndicatorColumn>--%>
                            <%--<ExpandCollapseColumn FilterControlAltText="Filter ExpandColumn column"></ExpandCollapseColumn>--%>
                        <Columns>
                            <telerik:GridBoundColumn DataField="MATERIAL_ID" HeaderText="Código"  
                                UniqueName="MATERIAL_ID"> 
                                <HeaderStyle Width="60px" /> 
                                <ItemStyle Font-Size="X-Small" Width="60px" /> 
                            </telerik:GridBoundColumn> 
                            <telerik:GridBoundColumn DataField="PES_CPF" HeaderText="CPF"  
                                UniqueName="PES_CPF"> 
                                <HeaderStyle Width="110px"  /> 
                                <ItemStyle Font-Size="X-Small" Width="110px" /> 
                            </telerik:GridBoundColumn> 
                            <telerik:GridBoundColumn DataField="PES_NOME" HeaderText="Nome"  
                                UniqueName="PES_NOME"> 
                                <HeaderStyle /> 
                                <ItemStyle Font-Size="X-Small" /> 
                            </telerik:GridBoundColumn> 
                            <telerik:GridBoundColumn DataField="PES_DTNASCIMENTO" HeaderText="Data nasc."  
                                UniqueName="PES_DTNASCIMENTO"> 
                                <HeaderStyle HorizontalAlign="Center" Width="85px" /> 
                                <ItemStyle  HorizontalAlign="Center" Font-Size="X-Small" Width="85px" /> 
                            </telerik:GridBoundColumn> 
                            <telerik:GridCheckBoxColumn DataField="PES_FALECIDO" HeaderText="Falecido" UniqueName="PES_FALECIDO" AllowFiltering="false">
                                <HeaderStyle HorizontalAlign="Center" Width="75px" /> 
                                <ItemStyle HorizontalAlign="Center" Width="75px" /> 
                            </telerik:GridCheckBoxColumn>                                               
                            <telerik:GridTemplateColumn UniqueName="TemplateColumn" HeaderText="Opções">
                                <ItemTemplate>
                                    <asp:ImageButton ID="imgGridEditar" runat="server" 
                                        ImageUrl="~/Imagens/grid_edit.png" ToolTip="Editar dados do Material" />                                    
                                    <asp:ImageButton ID="imgGridAlunosadquirentes" runat="server" 
                                        ImageUrl="~/Imagens/grid_user.png" ToolTip="Alunos adquirentes" />
                                    <%--<asp:ImageButton ID="imgbGridPNAplicavel" runat="server" 
                                        ImageUrl="~/Imagens/grid_engine.png" ToolTip="Part Numbers/Modelos Aplicáveis" />--%>
                                    <asp:ImageButton ID="imgbGridAuditoria" runat="server" 
                                        ImageUrl="~/Imagens/grid_audit.png" ToolTip="Auditoria" />
                                    <asp:ImageButton ID="imgbGridExcluir" runat="server" 
                                        ImageUrl="~/Imagens/grid_delete.png" ToolTip="Excluir" />
                                </ItemTemplate>
                                <HeaderStyle Width="95px" />
                                <ItemStyle HorizontalAlign="Center" Width="95px"/>
                            </telerik:GridTemplateColumn>
                        </Columns>

<EditFormSettings>
<%--<EditColumn FilterControlAltText="Filter EditCommandColumn column"></EditColumn>--%>
</EditFormSettings>
                    </MasterTableView>

<FilterMenu EnableImageSprites="False"></FilterMenu>

<HeaderContextMenu CssClass="GridContextMenu GridContextMenu_Sunset"></HeaderContextMenu>
                </telerik:RadGrid>
        </telerik:RadAjaxPanel>
            </td>
        </tr>
                            
    </table>

    </form>
</body>
</html>
